package zm.irc.message.processor;

import zm.irc.client.IrcClient;
import zm.irc.dao.MessageDao;
import zm.irc.ioc.annotation.AutoWired;
import zm.irc.ioc.annotation.Service;
import zm.irc.message.receive.IrcReceiveChatMessage;
import zm.irc.message.receive.IrcReceiveMessage;

@Service
public class DbLogProcessor implements IrcMessageProcessor{

    @AutoWired
    private MessageDao messageDao;

    @Override
    public boolean processor(IrcClient client, IrcReceiveMessage receivedMsg) {

        if(receivedMsg instanceof  IrcReceiveChatMessage) {
            this.messageDao.saveMessage((IrcReceiveChatMessage)receivedMsg);
        }else{
            //TBD
        }

        return true;
    }
}
